import axios from 'axios';
import queryString from 'qs';

export const getNetConfig = () => {
  return axios.get('/api/system/networkInfo');
};

export const testNetwork = () => {
  return axios.get('/api/system/network/test');
};

export const statusNetwork = () => {
  return axios.get('/api/system/network/status');
};

export const setNetConfig = body => {
  return axios.post('/api/system/networkInfo', body);
};

export const getDNSInfo = () => {
  return axios.get('/api/system/DNSInfo');
};

export const postDNSInfo = body => {
  return axios.post('/api/system/DNSInfo', body);
};

export const getRouteInfo = querys => {
  const query = queryString.stringify(querys);
  return axios.get(`/api/system/routeInfo?${query}`);
};

export const setRouteInfo = body => {
  return axios.post('/api/system/routeInfo', body);
};

export const deleteRouteInfo = body => {
  return axios.delete('/api/system/routeInfo', { data: body });
};
